home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / Resources.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  11.6 KB  |  590 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Resources.a
  3. ;
  4. ;    Contains:    Resource Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__RESOURCES__') = 'UNDEFINED' THEN
  21. __RESOURCES__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  30.     include 'MixedMode.a'
  31.     ENDIF
  32.  
  33.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  34.     include 'Files.a'
  35.     ENDIF
  36. ;        include 'OSUtils.a'                                        ;
  37. ;            include 'Memory.a'                                        ;
  38. ;        include 'Finder.a'                                            ;
  39.  
  40. resSysHeap                        EQU        64                    ;System or application heap?
  41. resPurgeable                    EQU        32                    ;Purgeable resource?
  42. resLocked                        EQU        16                    ;Load it in locked?
  43. resProtected                    EQU        8                    ;Protected?
  44. resPreload                        EQU        4                    ;Load in on OpenResFile?
  45. resChanged                        EQU        2                    ;Resource changed?
  46. mapReadOnly                        EQU        128                    ;Resource file read-only
  47. mapCompact                        EQU        64                    ;Compact resource file
  48. mapChanged                        EQU        32                    ;Write map out at update
  49. resSysRefBit                    EQU        7                    ;reference to system/local reference
  50. resSysHeapBit                    EQU        6                    ;In system/in application heap
  51. resPurgeableBit                    EQU        5                    ;Purgeable/not purgeable
  52. resLockedBit                    EQU        4                    ;Locked/not locked
  53. resProtectedBit                    EQU        3                    ;Protected/not protected
  54. resPreloadBit                    EQU        2                    ;Read in at OpenResource?
  55. resChangedBit                    EQU        1                    ;Existing resource changed since last update
  56. mapReadOnlyBit                    EQU        7                    ;is this file read-only?
  57. mapCompactBit                    EQU        6                    ;Is a compact necessary?
  58. mapChangedBit                    EQU        5                    ;Is it necessary to write map?
  59. kResFileNotOpened                EQU        -1                    ;ref num return as error when opening a resource file
  60. kSystemResFile                    EQU        0                    ;this is the default ref num to the system file
  61.  
  62. ;
  63. ; pascal short InitResources(void)
  64. ;
  65.     IF ¬ GENERATINGCFM THEN
  66.         _InitResources:    OPWORD    $A995
  67.     ELSE
  68.         IMPORT_CFM_FUNCTION    InitResources
  69.     ENDIF
  70.  
  71. ;
  72. ; pascal void RsrcZoneInit(void)
  73. ;
  74.     IF ¬ GENERATINGCFM THEN
  75.         _RsrcZoneInit:    OPWORD    $A996
  76.     ELSE
  77.         IMPORT_CFM_FUNCTION    RsrcZoneInit
  78.     ENDIF
  79.  
  80. ;
  81. ; pascal void CloseResFile(short refNum)
  82. ;
  83.     IF ¬ GENERATINGCFM THEN
  84.         _CloseResFile:    OPWORD    $A99A
  85.     ELSE
  86.         IMPORT_CFM_FUNCTION    CloseResFile
  87.     ENDIF
  88.  
  89. ;
  90. ; pascal short ResError(void)
  91. ;
  92.     IF ¬ GENERATINGCFM THEN
  93.         _ResError:    OPWORD    $A9AF
  94.     ELSE
  95.         IMPORT_CFM_FUNCTION    ResError
  96.     ENDIF
  97.  
  98. ;
  99. ; pascal short CurResFile(void)
  100. ;
  101.     IF ¬ GENERATINGCFM THEN
  102.         _CurResFile:    OPWORD    $A994
  103.     ELSE
  104.         IMPORT_CFM_FUNCTION    CurResFile
  105.     ENDIF
  106.  
  107. ;
  108. ; pascal short HomeResFile(Handle theResource)
  109. ;
  110.     IF ¬ GENERATINGCFM THEN
  111.         _HomeResFile:    OPWORD    $A9A4
  112.     ELSE
  113.         IMPORT_CFM_FUNCTION    HomeResFile
  114.     ENDIF
  115.  
  116. ;
  117. ; pascal void CreateResFile(ConstStr255Param fileName)
  118. ;
  119.     IF ¬ GENERATINGCFM THEN
  120.         _CreateResFile:    OPWORD    $A9B1
  121.     ELSE
  122.         IMPORT_CFM_FUNCTION    CreateResFile
  123.     ENDIF
  124.  
  125. ;
  126. ; pascal short OpenResFile(ConstStr255Param fileName)
  127. ;
  128.     IF ¬ GENERATINGCFM THEN
  129.         _OpenResFile:    OPWORD    $A997
  130.     ELSE
  131.         IMPORT_CFM_FUNCTION    OpenResFile
  132.     ENDIF
  133.  
  134. ;
  135. ; pascal void UseResFile(short refNum)
  136. ;
  137.     IF ¬ GENERATINGCFM THEN
  138.         _UseResFile:    OPWORD    $A998
  139.     ELSE
  140.         IMPORT_CFM_FUNCTION    UseResFile
  141.     ENDIF
  142.  
  143. ;
  144. ; pascal short CountTypes(void)
  145. ;
  146.     IF ¬ GENERATINGCFM THEN
  147.         _CountTypes:    OPWORD    $A99E
  148.     ELSE
  149.         IMPORT_CFM_FUNCTION    CountTypes
  150.     ENDIF
  151.  
  152. ;
  153. ; pascal short Count1Types(void)
  154. ;
  155.     IF ¬ GENERATINGCFM THEN
  156.         _Count1Types:    OPWORD    $A81C
  157.     ELSE
  158.         IMPORT_CFM_FUNCTION    Count1Types
  159.     ENDIF
  160.  
  161. ;
  162. ; pascal void GetIndType(ResType *theType, short index)
  163. ;
  164.     IF ¬ GENERATINGCFM THEN
  165.         _GetIndType:    OPWORD    $A99F
  166.     ELSE
  167.         IMPORT_CFM_FUNCTION    GetIndType
  168.     ENDIF
  169.  
  170. ;
  171. ; pascal void Get1IndType(ResType *theType, short index)
  172. ;
  173.     IF ¬ GENERATINGCFM THEN
  174.         _Get1IndType:    OPWORD    $A80F
  175.     ELSE
  176.         IMPORT_CFM_FUNCTION    Get1IndType
  177.     ENDIF
  178.  
  179. ;
  180. ; pascal void SetResLoad(Boolean load)
  181. ;
  182.     IF ¬ GENERATINGCFM THEN
  183.         _SetResLoad:    OPWORD    $A99B
  184.     ELSE
  185.         IMPORT_CFM_FUNCTION    SetResLoad
  186.     ENDIF
  187.  
  188. ;
  189. ; pascal short CountResources(ResType theType)
  190. ;
  191.     IF ¬ GENERATINGCFM THEN
  192.         _CountResources:    OPWORD    $A99C
  193.     ELSE
  194.         IMPORT_CFM_FUNCTION    CountResources
  195.     ENDIF
  196.  
  197. ;
  198. ; pascal short Count1Resources(ResType theType)
  199. ;
  200.     IF ¬ GENERATINGCFM THEN
  201.         _Count1Resources:    OPWORD    $A80D
  202.     ELSE
  203.         IMPORT_CFM_FUNCTION    Count1Resources
  204.     ENDIF
  205.  
  206. ;
  207. ; pascal Handle GetIndResource(ResType theType, short index)
  208. ;
  209.     IF ¬ GENERATINGCFM THEN
  210.         _GetIndResource:    OPWORD    $A99D
  211.     ELSE
  212.         IMPORT_CFM_FUNCTION    GetIndResource
  213.     ENDIF
  214.  
  215. ;
  216. ; pascal Handle Get1IndResource(ResType theType, short index)
  217. ;
  218.     IF ¬ GENERATINGCFM THEN
  219.         _Get1IndResource:    OPWORD    $A80E
  220.     ELSE
  221.         IMPORT_CFM_FUNCTION    Get1IndResource
  222.     ENDIF
  223.  
  224. ;
  225. ; pascal Handle GetResource(ResType theType, short theID)
  226. ;
  227.     IF ¬ GENERATINGCFM THEN
  228.         _GetResource:    OPWORD    $A9A0
  229.     ELSE
  230.         IMPORT_CFM_FUNCTION    GetResource
  231.     ENDIF
  232.  
  233. ;
  234. ; pascal Handle Get1Resource(ResType theType, short theID)
  235. ;
  236.     IF ¬ GENERATINGCFM THEN
  237.         _Get1Resource:    OPWORD    $A81F
  238.     ELSE
  239.         IMPORT_CFM_FUNCTION    Get1Resource
  240.     ENDIF
  241.  
  242. ;
  243. ; pascal Handle GetNamedResource(ResType theType, ConstStr255Param name)
  244. ;
  245.     IF ¬ GENERATINGCFM THEN
  246.         _GetNamedResource:    OPWORD    $A9A1
  247.     ELSE
  248.         IMPORT_CFM_FUNCTION    GetNamedResource
  249.     ENDIF
  250.  
  251. ;
  252. ; pascal Handle Get1NamedResource(ResType theType, ConstStr255Param name)
  253. ;
  254.     IF ¬ GENERATINGCFM THEN
  255.         _Get1NamedResource:    OPWORD    $A820
  256.     ELSE
  257.         IMPORT_CFM_FUNCTION    Get1NamedResource
  258.     ENDIF
  259.  
  260. ;
  261. ; pascal void LoadResource(Handle theResource)
  262. ;
  263.     IF ¬ GENERATINGCFM THEN
  264.         _LoadResource:    OPWORD    $A9A2
  265.     ELSE
  266.         IMPORT_CFM_FUNCTION    LoadResource
  267.     ENDIF
  268.  
  269. ;
  270. ; pascal void ReleaseResource(Handle theResource)
  271. ;
  272.     IF ¬ GENERATINGCFM THEN
  273.         _ReleaseResource:    OPWORD    $A9A3
  274.     ELSE
  275.         IMPORT_CFM_FUNCTION    ReleaseResource
  276.     ENDIF
  277.  
  278. ;
  279. ; pascal void DetachResource(Handle theResource)
  280. ;
  281.     IF ¬ GENERATINGCFM THEN
  282.         _DetachResource:    OPWORD    $A992
  283.     ELSE
  284.         IMPORT_CFM_FUNCTION    DetachResource
  285.     ENDIF
  286.  
  287. ;
  288. ; pascal short UniqueID(ResType theType)
  289. ;
  290.     IF ¬ GENERATINGCFM THEN
  291.         _UniqueID:    OPWORD    $A9C1
  292.     ELSE
  293.         IMPORT_CFM_FUNCTION    UniqueID
  294.     ENDIF
  295.  
  296. ;
  297. ; pascal short Unique1ID(ResType theType)
  298. ;
  299.     IF ¬ GENERATINGCFM THEN
  300.         _Unique1ID:    OPWORD    $A810
  301.     ELSE
  302.         IMPORT_CFM_FUNCTION    Unique1ID
  303.     ENDIF
  304.  
  305. ;
  306. ; pascal short GetResAttrs(Handle theResource)
  307. ;
  308.     IF ¬ GENERATINGCFM THEN
  309.         _GetResAttrs:    OPWORD    $A9A6
  310.     ELSE
  311.         IMPORT_CFM_FUNCTION    GetResAttrs
  312.     ENDIF
  313.  
  314. ;
  315. ; pascal void GetResInfo(Handle theResource, short *theID, ResType *theType, Str255 name)
  316. ;
  317.     IF ¬ GENERATINGCFM THEN
  318.         _GetResInfo:    OPWORD    $A9A8
  319.     ELSE
  320.         IMPORT_CFM_FUNCTION    GetResInfo
  321.     ENDIF
  322.  
  323. ;
  324. ; pascal void SetResInfo(Handle theResource, short theID, ConstStr255Param name)
  325. ;
  326.     IF ¬ GENERATINGCFM THEN
  327.         _SetResInfo:    OPWORD    $A9A9
  328.     ELSE
  329.         IMPORT_CFM_FUNCTION    SetResInfo
  330.     ENDIF
  331.  
  332. ;
  333. ; pascal void AddResource(Handle theData, ResType theType, short theID, ConstStr255Param name)
  334. ;
  335.     IF ¬ GENERATINGCFM THEN
  336.         _AddResource:    OPWORD    $A9AB
  337.     ELSE
  338.         IMPORT_CFM_FUNCTION    AddResource
  339.     ENDIF
  340.  
  341. ;
  342. ; pascal long GetResourceSizeOnDisk(Handle theResource)
  343. ;
  344.     IF ¬ GENERATINGCFM THEN
  345.         _GetResourceSizeOnDisk:    OPWORD    $A9A5
  346.     ELSE
  347.         IMPORT_CFM_FUNCTION    GetResourceSizeOnDisk
  348.     ENDIF
  349.  
  350. ;
  351. ; pascal long GetMaxResourceSize(Handle theResource)
  352. ;
  353.     IF ¬ GENERATINGCFM THEN
  354.         _GetMaxResourceSize:    OPWORD    $A821
  355.     ELSE
  356.         IMPORT_CFM_FUNCTION    GetMaxResourceSize
  357.     ENDIF
  358.  
  359. ;
  360. ; pascal long RsrcMapEntry(Handle theResource)
  361. ;
  362.     IF ¬ GENERATINGCFM THEN
  363.         _RsrcMapEntry:    OPWORD    $A9C5
  364.     ELSE
  365.         IMPORT_CFM_FUNCTION    RsrcMapEntry
  366.     ENDIF
  367.  
  368. ;
  369. ; pascal void SetResAttrs(Handle theResource, short attrs)
  370. ;
  371.     IF ¬ GENERATINGCFM THEN
  372.         _SetResAttrs:    OPWORD    $A9A7
  373.     ELSE
  374.         IMPORT_CFM_FUNCTION    SetResAttrs
  375.     ENDIF
  376.  
  377. ;
  378. ; pascal void ChangedResource(Handle theResource)
  379. ;
  380.     IF ¬ GENERATINGCFM THEN
  381.         _ChangedResource:    OPWORD    $A9AA
  382.     ELSE
  383.         IMPORT_CFM_FUNCTION    ChangedResource
  384.     ENDIF
  385.  
  386. ;
  387. ; pascal void RemoveResource(Handle theResource)
  388. ;
  389.     IF ¬ GENERATINGCFM THEN
  390.         _RemoveResource:    OPWORD    $A9AD
  391.     ELSE
  392.         IMPORT_CFM_FUNCTION    RemoveResource
  393.     ENDIF
  394.  
  395. ;
  396. ; pascal void UpdateResFile(short refNum)
  397. ;
  398.     IF ¬ GENERATINGCFM THEN
  399.         _UpdateResFile:    OPWORD    $A999
  400.     ELSE
  401.         IMPORT_CFM_FUNCTION    UpdateResFile
  402.     ENDIF
  403.  
  404. ;
  405. ; pascal void WriteResource(Handle theResource)
  406. ;
  407.     IF ¬ GENERATINGCFM THEN
  408.         _WriteResource:    OPWORD    $A9B0
  409.     ELSE
  410.         IMPORT_CFM_FUNCTION    WriteResource
  411.     ENDIF
  412.  
  413. ;
  414. ; pascal void SetResPurge(Boolean install)
  415. ;
  416.     IF ¬ GENERATINGCFM THEN
  417.         _SetResPurge:    OPWORD    $A993
  418.     ELSE
  419.         IMPORT_CFM_FUNCTION    SetResPurge
  420.     ENDIF
  421.  
  422. ;
  423. ; pascal short GetResFileAttrs(short refNum)
  424. ;
  425.     IF ¬ GENERATINGCFM THEN
  426.         _GetResFileAttrs:    OPWORD    $A9F6
  427.     ELSE
  428.         IMPORT_CFM_FUNCTION    GetResFileAttrs
  429.     ENDIF
  430.  
  431. ;
  432. ; pascal void SetResFileAttrs(short refNum, short attrs)
  433. ;
  434.     IF ¬ GENERATINGCFM THEN
  435.         _SetResFileAttrs:    OPWORD    $A9F7
  436.     ELSE
  437.         IMPORT_CFM_FUNCTION    SetResFileAttrs
  438.     ENDIF
  439.  
  440. ;
  441. ; pascal short OpenRFPerm(ConstStr255Param fileName, short vRefNum, SInt8 permission)
  442. ;
  443.     IF ¬ GENERATINGCFM THEN
  444.         _OpenRFPerm:    OPWORD    $A9C4
  445.     ELSE
  446.         IMPORT_CFM_FUNCTION    OpenRFPerm
  447.     ENDIF
  448.  
  449. ;
  450. ; pascal Handle RGetResource(ResType theType, short theID)
  451. ;
  452.     IF ¬ GENERATINGCFM THEN
  453.         _RGetResource:    OPWORD    $A80C
  454.     ELSE
  455.         IMPORT_CFM_FUNCTION    RGetResource
  456.     ENDIF
  457.  
  458.     IF SystemSevenOrLater  THEN
  459. ;
  460. ; pascal short HOpenResFile(short vRefNum, long dirID, ConstStr255Param fileName, SInt8 permission)
  461. ;
  462.     IF ¬ GENERATINGCFM THEN
  463.         _HOpenResFile:    OPWORD    $A81A
  464.     ELSE
  465.         IMPORT_CFM_FUNCTION    HOpenResFile
  466.     ENDIF
  467.  
  468.     ELSE
  469. ;
  470. ; pascal short HOpenResFile(short vRefNum, long dirID, ConstStr255Param fileName, SInt8 permission)
  471. ;
  472.     IF GENERATINGCFM THEN
  473.         IMPORT_CFM_FUNCTION    HOpenResFile
  474.     ENDIF
  475.  
  476.     ENDIF
  477.     IF SystemSevenOrLater  THEN
  478. ;
  479. ; pascal void HCreateResFile(short vRefNum, long dirID, ConstStr255Param fileName)
  480. ;
  481.     IF ¬ GENERATINGCFM THEN
  482.         _HCreateResFile:    OPWORD    $A81B
  483.     ELSE
  484.         IMPORT_CFM_FUNCTION    HCreateResFile
  485.     ENDIF
  486.  
  487.     ELSE
  488. ;
  489. ; pascal void HCreateResFile(short vRefNum, long dirID, ConstStr255Param fileName)
  490. ;
  491.     IF GENERATINGCFM THEN
  492.         IMPORT_CFM_FUNCTION    HCreateResFile
  493.     ENDIF
  494.  
  495.     ENDIF
  496. ;
  497. ; pascal short FSpOpenResFile(const FSSpec *spec, SignedByte permission)
  498. ;
  499.     IF ¬ GENERATINGCFM THEN
  500.         Macro
  501.         _FSpOpenResFile
  502.             moveq    #13,d0
  503.             dc.w     $AA52
  504.         EndM
  505.     ELSE
  506.         IMPORT_CFM_FUNCTION    FSpOpenResFile
  507.     ENDIF
  508.  
  509. ;
  510. ; pascal void FSpCreateResFile(const FSSpec *spec, OSType creator, OSType fileType, ScriptCode scriptTag)
  511. ;
  512.     IF ¬ GENERATINGCFM THEN
  513.         Macro
  514.         _FSpCreateResFile
  515.             moveq    #14,d0
  516.             dc.w     $AA52
  517.         EndM
  518.     ELSE
  519.         IMPORT_CFM_FUNCTION    FSpCreateResFile
  520.     ENDIF
  521.  
  522. ;  partial resource calls  
  523. ;
  524. ; pascal void ReadPartialResource(Handle theResource, long offset, void *buffer, long count)
  525. ;
  526.     IF ¬ GENERATINGCFM THEN
  527.         Macro
  528.         _ReadPartialResource
  529.             moveq    #1,d0
  530.             dc.w     $A822
  531.         EndM
  532.     ELSE
  533.         IMPORT_CFM_FUNCTION    ReadPartialResource
  534.     ENDIF
  535.  
  536. ;
  537. ; pascal void WritePartialResource(Handle theResource, long offset, const void *buffer, long count)
  538. ;
  539.     IF ¬ GENERATINGCFM THEN
  540.         Macro
  541.         _WritePartialResource
  542.             moveq    #2,d0
  543.             dc.w     $A822
  544.         EndM
  545.     ELSE
  546.         IMPORT_CFM_FUNCTION    WritePartialResource
  547.     ENDIF
  548.  
  549. ;
  550. ; pascal void SetResourceSize(Handle theResource, long newSize)
  551. ;
  552.     IF ¬ GENERATINGCFM THEN
  553.         Macro
  554.         _SetResourceSize
  555.             moveq    #3,d0
  556.             dc.w     $A822
  557.         EndM
  558.     ELSE
  559.         IMPORT_CFM_FUNCTION    SetResourceSize
  560.     ENDIF
  561.  
  562. ;
  563. ; pascal Handle GetNextFOND(Handle fondHandle)
  564. ;
  565.     IF ¬ GENERATINGCFM THEN
  566.         Macro
  567.         _GetNextFOND
  568.             moveq    #10,d0
  569.             dc.w     $A822
  570.         EndM
  571.     ELSE
  572.         IMPORT_CFM_FUNCTION    GetNextFOND
  573.     ENDIF
  574.  
  575. ; Use TempInsertROMMap to force the ROM resource map to be
  576. ;   inserted into the chain in front of the system. Note that
  577. ;   this call is only temporary - the modified resource chain
  578. ;   is only used for the next call to the resource manager.
  579. ;   See IM IV 19 for more information. 
  580. ;
  581. ; pascal void TempInsertROMMap(Boolean tempResLoad)
  582. ;
  583.     IF GENERATINGCFM THEN
  584.         IMPORT_CFM_FUNCTION    TempInsertROMMap
  585.     ENDIF
  586.  
  587.     IF OLDROUTINENAMES  THEN
  588.     ENDIF
  589.     ENDIF ; __RESOURCES__
  590.